<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
    <title>查询实名认证</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">

    <link rel="stylesheet" href="../css/bootstrap.min.css" />

    <script type="text/javascript" src="../js/jquery-1.12.4.js" ></script>

    <script type="text/javascript" src="../js/bootstrap.min.js" ></script>
    <script type="text/javascript" src="../js/jquery.bootstrap.min.js"></script>
    <script type="text/javascript" src="../js/plugins/jquery.form.js"></script>
    <script type="text/javascript" src="../js/plugins/jquery.twbsPagination.min.js"></script>


    <script type="text/javascript">
        function toPage(page) {
            $("#myfrom").attr("action", "userFileSelect?currPage=" + page);
            $("#myfrom").submit();
        }


        $(function () {

            var currPage = ${pager.currPage};

            var totalPages = ${pager.totalPages};

            if (currPage >= totalPages) {
                $("#next").removeAttr("href");
            }
            if (currPage <= 1) {
                $("#prev").removeAttr("href");
            }

            $(".btn_audit").click(function(){
                var form=$("#editform");
                form.find("[name=state]").val($(this).val());
                $("#myModal").modal("hide");
                form.ajaxSubmit(function(data){
                    if(data.success){
                         $.messager.confirm("提示",data.msg,function(){
                             window.location.reload(true);
                         });
                     }else{
                        $.messager.confirm("提示","系统故障，操作失败");
                     }
                });
                return false;
            });

        //审核操作
            $(".auditClass").click(function(){
                var json=$(this).data('json');
                $("#id").val(json.id);
                $("#username").html(json.applier);
                $("#image").attr("src",json.image);
                //alert(json.fileType);
                $("#title").html(json.fileType);
                $("#myModal").modal("show");
            });
        });

    </script>
</head>
<body>


<center>
    <h1>分页显示风控材料认证信息</h1>
</center>
<form id="myfrom" action="./userFileSelect" method="post">

    <center>
        <select name="state">
            <option value="-1">请选择</option>
            <option value="0">申请状态</option>
            <option value="1">审核通过</option>
            <option value="2">审核失败</option>
        </select>
        申请时间<input type="text" name="startDate" /> 到
        <input type="text" name="endDate" />
        <input type="submit" value="查询"/>
        <br/>
        <br />
    </center>
    <table align="center" width="70%" border="1px">
        <tr align="center">
            <td>用户名</td>
            <td>状态</td>
            <td>分数</td>
            <td>资料类型</td>
            <td>审核人</td>
        </tr>
        <c:forEach items="${list}" var="re" varStatus="st">
            <tr align="center"
                    <c:if test="${st.index %2 ==0 }">
                        style="background-color:lightblue"
                    </c:if>
            >
                <td>${re.applier.username}</td>
                <td>${re.getStateDisplay() }</td>
                <td>${re.score}</td>
                <td>${re.fileType.title}</td>
                <c:if test="${re.auditor.username!=null}" >
                    <td>${re.auditor.username}</td>
                </c:if>
                <c:if test="${re.auditor.username==null}">
                    <td><a href="javaScript:void(-1)" class="auditClass" data-json='{"id":"${re.id}","applier":"${re.applier.username}",
                                "fileType":"${re.fileType.title}","image":"${re.image}"}' >审核</a></td>
                </c:if>
            </tr>
        </c:forEach>
    </table>
    <center>
        <a href="javaScript:toPage(1)">首页</a>&nbsp;&nbsp;
        <a id="prev" href="javaScript:toPage(${pager.currPage-1 })">上一页</a>&nbsp;&nbsp;
        <a id="next" href="javaScript:toPage(${pager.currPage+1 })">下一页</a>&nbsp;&nbsp;
        <a href="javaScript:toPage(${pager.totalPages})">尾页</a>&nbsp;&nbsp;
        <span>第${pager.currPage }页/共${pager.totalPages }页</span>
    </center>

</form>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-body">
                <form class="form-horizontal" id="editform" method="post" action="./userFileDoUpdate">
                    <fieldset>
                        <div id="legend" class="">
                            <legend>风控材料认证审核</legend>
                        </div>
                        <input type="hidden" name="id" id="id" value="">
                        <input type="hidden" name="state" id="state" value="">
                        <div class="row">
                            <label class="col-sm-2 control-label" for="username">用户名</label>
                            <div class="col-sm-4">
                                <label class="form-control" name="username" id="username"></label>
                            </div>
                        </div>
                        <div class="row">
                            <label class="col-sm-2 control-label" >资料类型</label>
                            <div class="col-sm-4">
                                <label class="form-control" name="title" id="title"></label>
                            </div>
                        </div>
                        <div class="row">
                            <label class="col-sm-2 control-label" >资料图片</label>
                            <div class="col-sm-4">
                                <img src="" id="image" style="width: 150px;">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" >征信分数</label>
                            <div class="col-sm-4">
                                <select class="form-control"  name="score">
                                    <option value="1">1分</option>
                                    <option value="2">2分</option>
                                    <option value="3">3分</option>
                                    <option value="4">4分</option>
                                    <option value="5">5分</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="name">审核备注</label>
                            <div class="col-sm-6">
                                <textarea name="remark" rows="4" cols="60"></textarea>
                            </div>
                        </div>
                    </fieldset>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-success btn_audit" value="1">审核通过</button>
                <button type="button" class="btn btn-warning btn_audit" value="2">审核拒绝</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>
